import React, { Component } from 'react';

class Demo extends Component {
  constructor(props){
    super(props);
    console.log(props);//{msg:"牛"}
    console.log(this);//Demo
    console.log(this.props);//undefined=>{"msg":牛}
  }
  render() {
    console.log(this);//Demo
    console.log(this.props);//{msg:"牛"}
    return <h1>
      Demo组件{this.props.msg}
    </h1>
  }
}

class App extends Component{
  constructor(props){
    super(props);
  }
  render(){
    return (
      <div>
        <Demo msg="牛"></Demo>
      </div>
    );
  }
}
export default App;
